/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EmployeeTimeSheet.java
 *
 * Created on Sep 26, 2011, 12:24:56 PM
 */
package mollymadeapp;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Younes Souidi
 */
public class EmployeeTimeSheet extends javax.swing.JFrame {

    private static final long serialVersionUID = 1L;

    /** Creates new form EmployeeTimeSheet */
    public EmployeeTimeSheet() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        out = new javax.swing.JButton();
        In = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("MollyMaid");
        setBackground(new java.awt.Color(255, 153, 255));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setFont(new java.awt.Font("Tempus Sans ITC", 1, 18));
        setForeground(new java.awt.Color(255, 153, 255));
        setIconImages(null);
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
            }
        });

        jPanel1.setBackground(new java.awt.Color(251, 167, 218));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Molly Maid Timesheet", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Tempus Sans ITC", 1, 18), new java.awt.Color(0, 0, 153))); // NOI18N
        jPanel1.setForeground(java.awt.Color.orange);
        jPanel1.setToolTipText("Molly Maid TimeSheet");

        jLabel1.setFont(new java.awt.Font("Tempus Sans ITC", 1, 36));
        jLabel1.setForeground(new java.awt.Color(0, 0, 153));
        jLabel1.setText("Please Press Enter then Put your employee Pin");

        jLabel2.setFont(new java.awt.Font("Tempus Sans ITC", 1, 36));
        jLabel2.setForeground(new java.awt.Color(0, 0, 153));
        jLabel2.setText("Por favor, pulse Enter a continuación, poner su ID de empleado");

        out.setBackground(new java.awt.Color(255, 204, 255));
        out.setFont(new java.awt.Font("Tempus Sans ITC", 1, 36));
        out.setForeground(new java.awt.Color(0, 0, 153));
        out.setText("out");
        out.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        out.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                outActionPerformed(evt);
            }
        });
        out.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                outKeyPressed(evt);
            }
        });

        In.setBackground(new java.awt.Color(255, 204, 255));
        In.setFont(new java.awt.Font("Tempus Sans ITC", 1, 36));
        In.setForeground(new java.awt.Color(0, 0, 153));
        In.setText("In");
        In.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        In.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                InActionPerformed(evt);
            }
        });
        In.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                InKeyPressed(evt);
            }
        });

        jLabel3.setBackground(new java.awt.Color(255, 204, 255));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mollymadeapp/molly3.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1290, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 1280, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(442, Short.MAX_VALUE)
                .addComponent(In, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(154, 154, 154)
                .addComponent(out, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(198, 198, 198))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(582, 582, 582)
                .addComponent(jLabel3)
                .addContainerGap(471, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel3)
                .addGap(37, 37, 37)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(136, 136, 136)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 139, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(out)
                    .addComponent(In))
                .addGap(69, 69, 69))
        );

        jMenuBar1.setBackground(new java.awt.Color(255, 204, 255));
        jMenuBar1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tempus Sans ITC", 1, 18), new java.awt.Color(255, 204, 255))); // NOI18N
        jMenuBar1.setForeground(new java.awt.Color(255, 204, 255));
        jMenuBar1.setAlignmentX(0.0F);
        jMenuBar1.setFont(new java.awt.Font("Simplified Arabic", 1, 10));
        jMenuBar1.setMaximumSize(new java.awt.Dimension(40, 32780));
        jMenuBar1.setPreferredSize(new java.awt.Dimension(114, 50));
        jMenuBar1.setVerifyInputWhenFocusTarget(false);

        jMenu1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tempus Sans ITC", 1, 14))); // NOI18N
        jMenu1.setText("File");
        jMenu1.setFont(new java.awt.Font("Segoe UI", 1, 18));

        jMenuItem1.setFont(new java.awt.Font("Segoe UI", 1, 18));
        jMenuItem1.setText("Create a File");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuItem3.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jMenuItem3.setText("Add Employee");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuItem2.setFont(new java.awt.Font("Segoe UI", 1, 18));
        jMenuItem2.setText("Exit ");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        jMenu2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tempus Sans ITC", 1, 18))); // NOI18N
        jMenu2.setText("Edit");
        jMenu2.setFont(new java.awt.Font("Segoe UI", 1, 18));
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    @SuppressWarnings("ObjectEqualsNull")
    private void outActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outActionPerformed
        // TODO add your handling code here:
        BufferedReader br = null;
        try {
            // TODO add your handling code here:
            BufferedWriter write;
            BufferedWriter out;
            PassWord pa = new PassWord();
            String newFile = pa.getPassWord();
            File file;
            File f;
            File f2;
            //  File file = new File("C:\\Users\\Younes Souidi\\Desktop\\MollyMadeTime.csv");
//            file = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\" + newFile + ".csv");
//            f = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\eCode.txt");
//            f2 = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\code.txt");
            file = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\" + newFile + ".csv");
            f = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\names.txt");
            f2 = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\code.txt");
            //String employeeNames[] = {"younes souidi", "anasse souidi", "Adam souidi", "Taha lhlou", "Samy souidi", "Hamid souidi"};
            String eCode = JOptionPane.showInputDialog(null, "Enter your Employee ID", "MollyMaid", JOptionPane.INFORMATION_MESSAGE);
            br = new BufferedReader(new FileReader(f));
            BufferedReader br2 = new BufferedReader(new FileReader(f2));
            String line;
            String line2;
            String name = null;
            boolean exist = false;
            ArrayList<String> employeeNames = new ArrayList<String>();
            ArrayList<String> employeeId = new ArrayList<String>();
            while ((line = br.readLine()) != null) {

                employeeNames.add(line);

            }
            while ((line2 = br2.readLine()) != null) {

                employeeId.add(line2);
            }
            Date myDate = new Date();
            Date myHour = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String myDateString = sdf.format(myDate);
            SimpleDateFormat sdfh = new SimpleDateFormat("HH-mm-ss");
            String myDateStringHour = sdfh.format(myHour);
            try {
                for (int i = 0; i < employeeId.size(); i++) {
                    if (eCode.equals(employeeId.get(i))) {
                        name = employeeNames.get(i);

               }  else  {
                    JOptionPane.showMessageDialog(null, "Wrong employee ID Please try again");

                    }
                }
                if (!name.equals(null)) {
                    JOptionPane.showMessageDialog(null, name + " :" + "\n" + "Time :      " + myDateStringHour + "\n " + "Day :     " + myDateString + "\n" + "You are Signed out", "MollyMaid", JOptionPane.INFORMATION_MESSAGE);
                    System.out.println(name);
                } else {
                }

                write = new BufferedWriter(new FileWriter(file, true));
                out = new BufferedWriter(new FileWriter(file, true));
                //    write.write("Firstandlastname" + "," + "Fistname" + "," + "LastName" + "," + "Date" + "," + "time" + "," + "hour" + "," + "Minutes" + "," + "seconds");
                ArrayList<String> MML = new ArrayList<String>();

                MML.add(eCode + "," + name + "," + name.replace(" ", ",") + "," + myDateString + "," + myDateStringHour + "," + myDateStringHour.replace("-", ",") + "," + "out");

                for (int i = 0; i < MML.size(); i++) {
                    write.write(MML.get(i));
                    write.newLine();
                }
                write.close();
            } catch (Exception e) {
            }
        } catch (IOException ex) {
            Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                br.close();
            } catch (IOException ex) {
                Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_outActionPerformed

    private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowGainedFocus

    private void outKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_outKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_outKeyPressed

    private void InActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InActionPerformed
        BufferedReader br = null;
        try {
            // TODO add your handling code here:
            BufferedWriter write;
            BufferedWriter out;
            PassWord pa = new PassWord();
            String newFile = pa.getPassWord();
            File file;
            File f;
            File f2;
//            //  File file = new File("C:\\Users\\Younes Souidi\\Desktop\\MollyMadeTime.csv");
//            file = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\" + newFile + ".csv");
//            f = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\eCode.txt");
//            f2 = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\code.txt");
            file = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\" + newFile + ".csv");
            f = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\names.txt");
            f2 = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\code.txt");
            //String employeeNames[] = {"younes souidi", "anasse souidi", "Adam souidi", "Taha lhlou", "Samy souidi", "Hamid souidi"};
            String eCode = JOptionPane.showInputDialog(null, "Enter your Employee ID", "MollyMaid", JOptionPane.INFORMATION_MESSAGE);
            br = new BufferedReader(new FileReader(f));
            BufferedReader br2 = new BufferedReader(new FileReader(f2));
            String line;
            String line2;
            String name = null;

            ArrayList<String> employeeNames = new ArrayList<String>();
            ArrayList<String> employeeId = new ArrayList<String>();
            while ((line = br.readLine()) != null) {

                employeeNames.add(line);

            }
            while ((line2 = br2.readLine()) != null) {

                employeeId.add(line2);
            }
            Date myDate = new Date();
            Date myHour = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String myDateString = sdf.format(myDate);
            SimpleDateFormat sdfh = new SimpleDateFormat("HH-mm-ss");
            String myDateStringHour = sdfh.format(myHour);
            try {
                for (int i = 0; i < employeeId.size(); i++) {
                    if (eCode.equals(employeeId.get(i))) {
                        name = employeeNames.get(i);

                }   if( !employeeId.get(i).equals(employeeId.get(i))){
                    JOptionPane.showMessageDialog(null, "Wrong employee ID Please try again");
                    }
}
                if (!name.equals(null)) {
                    JOptionPane.showMessageDialog(null, name + " :" + "\n" + "Time :      " + myDateStringHour + "\n " + "Day :     " + myDateString + "\n" + "You are Signed in", "MollyMaid", JOptionPane.INFORMATION_MESSAGE);
                    System.out.println(name);
                } else {
                }

                write = new BufferedWriter(new FileWriter(file, true));
                out = new BufferedWriter(new FileWriter(file, true));
                //    write.write("Firstandlastname" + "," + "Fistname" + "," + "LastName" + "," + "Date" + "," + "time" + "," + "hour" + "," + "Minutes" + "," + "seconds");
                ArrayList<String> MML = new ArrayList<String>();

                MML.add(eCode + "," + name + "," + name.replace(" ", ",") + "," + myDateString + "," + myDateStringHour + "," + myDateStringHour.replace("-", ",") + "," + "in");

                for (int i = 0; i < MML.size(); i++) {
                    write.write(MML.get(i));
                    write.newLine();
                }
                write.close();
            } catch (Exception e) {
            }
        } catch (IOException ex) {
            Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                br.close();
            } catch (IOException ex) {
                Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_InActionPerformed

    private void InKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_InKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_InKeyPressed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        PassWord paa = new PassWord();
        String newFile = null;
        BufferedWriter writer;
        newFile = JOptionPane.showInputDialog(rootPane, "Create new file", "Molly maid", JOptionPane.YES_NO_CANCEL_OPTION);
        paa.setPassWord(newFile);

        // File file = new File("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\" + newFile + ".csv");
        File file = new File("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\" + newFile + ".csv");

        if (!file.exists()) {
            try {
                file.createNewFile();
                try {

                    writer = new BufferedWriter(new FileWriter(file));
                    writer.write("EmployeeID" + "," + "Firstandlastname" + "," + "Fistname" + "," + "LastName" + "," + "Date" + "," + "time" + "," + "hour" + "," + "Minutes" + "," + "seconds" + "," + "EmployeeStatus");
                    writer.newLine();
                    writer.close();
                } catch (IOException ex) {
                    Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
                }
            } catch (IOException ex) {
                Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            JOptionPane.showMessageDialog(rootPane, "the file " + file.getName() + " exists in " + file.getPath() + " Please chose another name");
        }


    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:

        String cod = Password2.pass;
        String passcod = JOptionPane.showInputDialog(null, "Enter your passcod ", "Molly Maid", JOptionPane.CLOSED_OPTION);

        if (cod.equals(passcod)) {
            System.exit(0);
        } else if (!cod.equals(passcod) && !"".equals(passcod)) {
            JOptionPane.showMessageDialog(null, "Wrong password please try again", "Molly Maid", JOptionPane.PLAIN_MESSAGE);

        } else {
        }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        BufferedWriter bw = null;
        BufferedWriter bw2 = null;


        try {
            // TODO add your handling code here:
            FileWriter f;
            FileWriter f2;
            String name = JOptionPane.showInputDialog("Enter the new Employee Name");
//            f = new FileWriter("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\eCode.txt", true);
//            f2 = new FileWriter("C:\\Documents and Settings\\Molly maid.MOLLYMAID.000\\Desktop\\TimeSheet\\code.txt", true);

            f = new FileWriter("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\names.txt", true);
            f2 = new FileWriter("C:\\Users\\Younes Souidi\\Desktop\\TimeSheet\\code.txt", true);


            bw = new BufferedWriter(f);
            bw2 = new BufferedWriter(f2);

            bw.write(name.toUpperCase());
            bw.newLine();
            bw.close();
            if (name != null) {
                String code = JOptionPane.showInputDialog("Enter new Employee code:");

                bw2.write(code);
                bw2.newLine();
                bw2.close();

            }else{
               JOptionPane.showMessageDialog(null,"Name Exist ");
            }
        } catch (IOException ex) {
            Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                bw.close();
            } catch (IOException ex) {
                Logger.getLogger(EmployeeTimeSheet.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EmployeeTimeSheet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EmployeeTimeSheet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EmployeeTimeSheet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EmployeeTimeSheet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new EmployeeTimeSheet().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton In;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton out;
    // End of variables declaration//GEN-END:variables
}
